# -*- encoding: utf-8 -*-
"""
License: Commercial
Copyright (c) 2019 - present AppSeed.us
"""

from flask_migrate import Migrate
from os import environ
from config import config_dict
from app import create_app, db


get_config_mode = environ.get('APPSEED_CONFIG_MODE', 'Debug')

# try:
#     config_mode = config_dict[get_config_mode.capitalize()]
# except KeyError:
#     print('配置config出错')
#     exit('Error: Invalid APPSEED_CONFIG_MODE environment variable entry.')

config_mode = config_dict[get_config_mode.capitalize()]
app = create_app(config_mode)
Migrate(app, db)


if __name__ == "__main__":
    app.run()
